import { Sequelize } from "sequelize";

//实例化数据库

export const sequelize=new Sequelize({
    dialect:'sqlite',
    storage:'./db.db'
});


export const sync=async ()=>{
        const {Blog} =await import('../model/Blog.js')//实例化Blog
        await sequelize.sync({force: true}) //强制删除数据库重新来过
        let arr=[
            {
                title:"真真假假",
                author:"zzaisx"
            },
            {
                title:"高高兴兴",
                author:"zzaisx"
            },
            {
                title:"开开心心",
                author:"zzaisx"
            },
            {
                title:"红红火火",
                author:"zzaisx"
            },
            {
                title:"恍恍惚惚",
                author:"zzaisx"
            } 
        ]
        Blog.bulkCreate(arr)
}   